package com.iss.okair.db.mapper.transsql;

import com.iss.okair.db.entity.AssetsTranUse;
import com.iss.okair.db.entity.Assetstrans;
import org.apache.ibatis.jdbc.SQL;

public class CarTransSQL {
    public String find(AssetsTranUse model){
        return new SQL(){{
            SELECT("*");
            FROM("checkinlist c JOIN assets_car f on c.assetsCode= f.assetsCode");
            if(model.getAssetsnamecn()!=null && !model.getAssetsnamecn().isEmpty()){
                WHERE("nameCn like '"+model.getAssetsnamecn() +"%'");
            }
            if(model.getBatchno()!=null && !model.getBatchno().isEmpty()){
                WHERE("batchNo like '"+model.getBatchno() +"%'");
            }
        }}.toString();
    }
    public String findout(AssetsTranUse model){
        return new SQL(){{
            SELECT("*");
            FROM("checkoutlist c JOIN assets_car f on c.assetsCode= f.assetsCode");
            if(model.getAssetsnamecn()!=null && !model.getAssetsnamecn().isEmpty()){
                WHERE("nameCn like '"+model.getAssetsnamecn() +"%'");
            }
            if(model.getBatchno()!=null && !model.getBatchno().isEmpty()){
                WHERE("batchNo like '"+model.getBatchno() +"%'");
            }
        }}.toString();
    }
}
